<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
function delUserForToken($token)
{
    return delCache("Token_" . $token);
}
function createToken()
{
    return uuid();
}
function checkPasswd($passwd, $offset, $hash)
{
    return password_verify($offset . $passwd . $offset, $hash);
}
function getAccountList($uniacid = 7777)
{
    $result = getCache("accounts_" . $uniacid);
    if(!empty($result)) {
        return $result;
    }
    return $result;
}
function setAccountToCache($account, $uniacid = 7777)
{
    if(!getaccountlist($uniacid)) {
        return setCache("accounts_" . $uniacid, [$account]);
    }
    return pushCache("accounts_" . $uniacid, $account);
}
function delAccountToCache($account, $uniacid = 7777)
{
}
function checkAccountIsExist($account, $uniacid = 7777)
{
    $result = false;
    $count = app\admin\model\Admin::where(["account" => $account, "uniacid" => $uniacid, "deleted" => 0])->count();
    if(!empty($count)) {
        $result = true;
    }
    return $result;
}
function getRole($role_name = "user", $uniacid = 7777)
{
    $list_role = listRole($uniacid);
    foreach ($list_role as $role) {
        if(in_array($role_name, [$role["role_name"]])) {
            unset($role_name);
        }
        return $role;
    }
    return false;
}
function getRoleModel()
{
    return new app\admin\model\Role();
}
function listRole($uniacid = 7777)
{
    $result = getCache("ListRole" . $uniacid);
    if(!empty($result)) {
        return $result;
    }
    $role_modle = getrolemodel();
    $list_role = $role_modle->listRoleAll(["uniacid" => $uniacid]);
    if(!empty($list_role)) {
        setCache("ListRole" . $uniacid, $list_role, 3600);
        foreach ($list_role as $role) {
            setCache("role_" . $uniacid . "_" . $role["role_id"], $role, 3600);
        }
    }
    return $list_role;
}
function ckeckRole($role_id, $uniacid = 7777)
{
    $list_role = listrole($uniacid);
    unset($list_role);
    return getCache("role_" . $uniacid . "_" . $role["role_id"]);
}
function listUserFilter($filter)
{
    $data = ["user.deleted" => 0, "role.deleted" => 0];
    if(isset($filter["user_id"])) {
        $data["user.user_id"] = $filter["user_id"];
    }
    if(isset($filter["account"])) {
        $data["user.account"] = ["like", "%" . $filter["account"] . "%"];
    }
    if(isset($filter["name"])) {
        $data["user.name"] = ["like", "%" . $filter["name"] . "%"];
    }
    if(isset($filter["creator_id"])) {
        $data["user.creator_id"] = $filter["creator_id"];
    }
    if(isset($filter["status"])) {
        $data["status"] = $filter["status"];
    }
    if(isset($filter["nickname"])) {
        $data["user.nickname"] = ["like", "%" . $filter["nickname"] . "%"];
    }
    if(isset($filter["certificate_num"])) {
        $data["user.certificate_num"] = $filter["certificate_num"];
    }
    if(isset($filter["email"])) {
        $data["user.email"] = ["like", "%" . $filter["email"] . "%"];
    }
    if(isset($filter["wechat"])) {
        $data["user.wechat"] = ["like", "%" . $filter["wechat"] . "%"];
    }
    if(isset($filter["qq"])) {
        $data["user.qq"] = ["like", "%" . $filter["qq"] . "%"];
    }
    if(isset($filter["mobile"])) {
        $data["user.mobile"] = ["like", "%" . $filter["mobile"] . "%"];
    }
    if(isset($filter["role_id"])) {
        $data["user.role_id"] = $filter["role_id"];
    }
    if(isset($filter["uniacid"])) {
        $data["user.uniacid"] = $filter["uniacid"];
    }
    if(isset($filter["department_id"])) {
        $data["user.department_id"] = $filter["department_id"];
    }
    return $data;
}
function getUpdateUserFilter($data)
{
    if(isset($data["user_id"])) {
        unset($data["user_id"]);
    }
    if(isset($data["offset"])) {
        unset($data["offset"]);
    }
    if(isset($data["create_time"])) {
        unset($data["create_time"]);
    }
    if(isset($data["update_time"])) {
        unset($data["update_time"]);
    }
    if(isset($data["delete_time"])) {
        unset($data["delete_time"]);
    }
    return $data;
}
function getOssConfigData($data)
{
    $result["open_oss"] = 0;
    if(isset($data["miniapp_name"])) {
        $result["miniapp_name"] = $data["miniapp_name"];
    }
    if(isset($data["open_oss"]) && in_array($data["open_oss"], [0, 1, 2, 3, "0", "1", "2", "3"])) {
        $result["open_oss"] = $data["open_oss"];
    }
    if(isset($data["aliyun_bucket"])) {
        $result["aliyun_bucket"] = $data["aliyun_bucket"];
    }
    if(isset($data["aliyun_access_key_id"])) {
        $result["aliyun_access_key_id"] = $data["aliyun_access_key_id"];
    }
    if(isset($data["aliyun_access_key_secret"])) {
        $result["aliyun_access_key_secret"] = $data["aliyun_access_key_secret"];
    }
    if(isset($data["aliyun_base_dir"])) {
        $result["aliyun_base_dir"] = $data["aliyun_base_dir"];
    }
    if(isset($data["aliyun_zidinyi_yuming"])) {
        $result["aliyun_zidinyi_yuming"] = $data["aliyun_zidinyi_yuming"];
    }
    if(isset($data["aliyun_endpoint"])) {
        $result["aliyun_endpoint"] = $data["aliyun_endpoint"];
    }
    if(isset($data["aliyun_rules"])) {
        $result["aliyun_rules"] = $data["aliyun_rules"];
    }
    if(isset($data["qiniu_accesskey"])) {
        $result["qiniu_accesskey"] = $data["qiniu_accesskey"];
    }
    if(isset($data["qiniu_secretkey"])) {
        $result["qiniu_secretkey"] = $data["qiniu_secretkey"];
    }
    if(isset($data["qiniu_bucket"])) {
        $result["qiniu_bucket"] = $data["qiniu_bucket"];
    }
    if(isset($data["qiniu_yuming"])) {
        $result["qiniu_yuming"] = $data["qiniu_yuming"];
    }
    if(isset($data["qiniu_rules"])) {
        $result["qiniu_rules"] = $data["qiniu_rules"];
    }
    if(isset($data["tenxunyun_appid"])) {
        $result["tenxunyun_appid"] = $data["tenxunyun_appid"];
    }
    if(isset($data["tenxunyun_secretid"])) {
        $result["tenxunyun_secretid"] = $data["tenxunyun_secretid"];
    }
    if(isset($data["tenxunyun_secretkey"])) {
        $result["tenxunyun_secretkey"] = $data["tenxunyun_secretkey"];
    }
    if(isset($data["tenxunyun_bucket"])) {
        $result["tenxunyun_bucket"] = $data["tenxunyun_bucket"];
    }
    if(isset($data["tenxunyun_region"])) {
        $result["tenxunyun_region"] = $data["tenxunyun_region"];
    }
    if(isset($data["tenxunyun_yuming"])) {
        $result["tenxunyun_yuming"] = $data["tenxunyun_yuming"];
    }
    if(isset($data["apiclient_cert"])) {
        $result["apiclient_cert"] = $data["apiclient_cert"];
    }
    if(isset($data["apiclient_key"])) {
        $result["apiclient_key"] = $data["apiclient_key"];
    }
    return $result;
}
function longbingGetAppTabbarResponse($data)
{
    if(empty($data)) {
        return [];
    }
    $data["data"] = [];
    $menus = [];
    if(isset($data["menu1_is_hide"])) {
        $val = ["menu_name" => "card"];
        $val["is_show"] = $data["menu1_is_hide"];
        if(isset($data["menu1_name"])) {
            $val["name"] = $data["menu1_name"];
        }
        if(isset($data["menu1_url"])) {
            $val["url"] = $data["menu1_url"];
        }
        if(isset($data["menu1_url_out"])) {
            $val["url_out"] = $data["menu1_url_out"];
        }
        if(isset($data["menu1_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu1_url_jump_way"];
        }
        $data["data"]["card"] = $val;
    }
    if(isset($data["menu2_is_hide"])) {
        $val = ["menu_name" => "shop"];
        $val["is_show"] = $data["menu2_is_hide"];
        if(isset($data["menu2_name"])) {
            $val["name"] = $data["menu2_name"];
        }
        if(isset($data["menu2_url"])) {
            $val["url"] = $data["menu2_url"];
        }
        if(isset($data["menu2_url_out"])) {
            $val["url_out"] = $data["menu2_url_out"];
        }
        if(isset($data["menu2_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu2_url_jump_way"];
        }
        $data["data"]["shop"] = $val;
    }
    if(isset($data["menu3_is_hide"])) {
        $val = ["menu_name" => "dynamic"];
        $val["is_show"] = $data["menu3_is_hide"];
        if(isset($data["menu3_name"])) {
            $val["name"] = $data["menu3_name"];
        }
        if(isset($data["menu3_url"])) {
            $val["url"] = $data["menu3_url"];
        }
        if(isset($data["menu3_url_out"])) {
            $val["url_out"] = $data["menu3_url_out"];
        }
        if(isset($data["menu3_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu3_url_jump_way"];
        }
        $data["data"]["dynamic"] = $val;
    }
    if(isset($data["menu4_is_hide"])) {
        $val = ["menu_name" => "website"];
        $val["is_show"] = $data["menu4_is_hide"];
        $menus[] = "menu4_name";
        if(isset($data["menu4_name"])) {
            $val["name"] = $data["menu4_name"];
        }
        if(isset($data["menu4_url"])) {
            $val["url"] = $data["menu4_url"];
        }
        if(isset($data["menu4_url_out"])) {
            $val["url_out"] = $data["menu4_url_out"];
        }
        if(isset($data["menu4_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu4_url_jump_way"];
        }
        $data["data"]["website"] = $val;
    }
    if(isset($data["menu_appoint_is_hide"])) {
        $val = ["menu_name" => "appointment"];
        $val["is_show"] = $data["menu_appoint_is_hide"];
        if(isset($data["menu_appoint_name"])) {
            $val["name"] = $data["menu_appoint_name"];
        }
        if(isset($data["menu_appoint_url"])) {
            $val["url"] = $data["menu_appoint_url"];
        }
        if(isset($data["menu_appoint_url_out"])) {
            $val["url_out"] = $data["menu_appoint_url_out"];
        }
        if(isset($data["menu_appoint_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_appoint_url_jump_way"];
        }
        $data["data"]["appointment"] = $val;
    }
    if(isset($data["menu_activity_is_show"])) {
        $val = ["menu_name" => "activity"];
        $val["is_show"] = $data["menu_activity_is_show"];
        if(isset($data["menu_activity_name"])) {
            $val["name"] = $data["menu_activity_name"];
        }
        if(isset($data["menu_activity_url"])) {
            $val["url"] = $data["menu_activity_url"];
        }
        if(isset($data["menu_activity_url_out"])) {
            $val["url_out"] = $data["menu_activity_url_out"];
        }
        if(isset($data["menu_activity_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_activity_url_jump_way"];
        }
        $data["data"]["activity"] = $val;
    }
    if(isset($data["menu_house_is_show"])) {
        $val = ["menu_name" => "house"];
        $val["is_show"] = $data["menu_house_is_show"];
        if(isset($data["menu_house_name"])) {
            $val["name"] = $data["menu_house_name"];
        }
        if(isset($data["menu_house_url"])) {
            $val["url"] = $data["menu_house_url"];
        }
        if(isset($data["menu_house_url_out"])) {
            $val["url_out"] = $data["menu_house_url_out"];
        }
        if(isset($data["menu_house_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_house_url_jump_way"];
        }
        $data["data"]["house"] = $val;
    }
    $menus = ["menu1_name", "menu1_is_hide", "menu1_url", "menu1_url_out", "menu1_url_jump_way", "menu2_name", "menu2_is_hide", "menu2_url", "menu2_url_out", "menu2_url_jump_way", "menu3_name", "menu3_is_hide", "menu3_url", "menu3_url_out", "menu3_url_jump_way", "menu4_name", "menu4_is_hide", "menu4_url", "menu4_url_out", "menu4_url_jump_way", "menu_appoint_name", "menu_appoint_is_hide", "menu_appoint_url", "menu_appoint_url_out", "menu_appoint_url_jump_way", "menu_activity_is_show", "menu_activity_name", "menu_activity_is_hide", "menu_activity_url", "menu_activity_url_out", "menu_activity_url_jump_way", "menu_house_is_show", "menu_house_name", "menu_house_is_hide", "menu_house_url", "menu_house_url_out", "menu_house_url_jump_way"];
    foreach ($menus as $menu) {
        unset($data[$menu]);
    }
    return $data;
}
function longbingGetWxAppTabbarResponse($data)
{
    if(empty($data)) {
        return [];
    }
    $data["data"] = [];
    $menus = [];
    if(isset($data["menu1_is_hide"]) && !empty($data["menu1_is_hide"])) {
        $val = [];
        $val["is_show"] = $data["menu1_is_hide"];
        $val["key"] = 1;
        $val["iconPath"] = "icon-mingpian";
        $val["selectedIconPath"] = "icon-mingpian1";
        $val["pageComponents"] = "cardHome";
        if(isset($data["menu1_name"])) {
            $val["name"] = $data["menu1_name"];
        }
        if(isset($data["menu1_url"])) {
            $val["url"] = $data["menu1_url"];
        }
        if(isset($data["menu1_url_out"])) {
            $val["url_out"] = $data["menu1_url_out"];
        }
        if(isset($data["menu1_url_jump_way"])) {
            $val["jump_way"] = $data["menu1_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu2_is_hide"]) && !empty($data["menu2_is_hide"])) {
        $val = [];
        $val["key"] = 2;
        $val["is_show"] = $data["menu2_is_hide"];
        $val["iconPath"] = "icon-shangcheng1";
        $val["selectedIconPath"] = "icon-shangcheng";
        $val["pageComponents"] = "shopHome";
        if(isset($data["menu2_name"])) {
            $val["name"] = $data["menu2_name"];
        }
        if(isset($data["menu2_url"])) {
            $val["url"] = $data["menu2_url"];
        }
        if(isset($data["menu2_url_out"])) {
            $val["url_out"] = $data["menu2_url_out"];
        }
        if(isset($data["menu2_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu2_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu3_is_hide"]) && !empty($data["menu3_is_hide"])) {
        $val = [];
        $val["key"] = 3;
        $val["is_show"] = $data["menu3_is_hide"];
        $val["iconPath"] = "icon-dongtai1";
        $val["selectedIconPath"] = "icon-dongtai";
        $val["pageComponents"] = "infoHome";
        if(isset($data["menu3_name"])) {
            $val["name"] = $data["menu3_name"];
        }
        if(isset($data["menu3_url"])) {
            $val["url"] = $data["menu3_url"];
        }
        if(isset($data["menu3_url_out"])) {
            $val["url_out"] = $data["menu3_url_out"];
        }
        if(isset($data["menu3_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu3_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu4_is_hide"]) && !empty($data["menu4_is_hide"])) {
        $val = [];
        $val["key"] = 4;
        $val["is_show"] = $data["menu4_is_hide"];
        $val["iconPath"] = "icon-guanwang";
        $val["selectedIconPath"] = "icon-guanwang1";
        $val["pageComponents"] = "websiteHome";
        if(isset($data["menu4_name"])) {
            $val["name"] = $data["menu4_name"];
        }
        if(isset($data["menu4_url"])) {
            $val["url"] = $data["menu4_url"];
        }
        if(isset($data["menu4_url_out"])) {
            $val["url_out"] = $data["menu4_url_out"];
        }
        if(isset($data["menu4_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu4_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu_appoint_is_hide"]) && !empty($data["menu_appoint_is_hide"])) {
        $val = [];
        $val["key"] = 7;
        $val["is_show"] = $data["menu_appoint_is_hide"];
        $val["iconPath"] = "icon-yuyue";
        $val["selectedIconPath"] = "icon-yuyue1";
        $val["pageComponents"] = "reserveHome";
        if(isset($data["menu_appoint_name"])) {
            $val["name"] = $data["menu_appoint_name"];
        }
        if(isset($data["menu_appoint_url"])) {
            $val["url"] = $data["menu_appoint_url"];
        }
        if(isset($data["menu_appoint_url_out"])) {
            $val["url_out"] = $data["menu_appoint_url_out"];
        }
        if(isset($data["menu_appoint_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_appoint_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu_activity_is_show"]) && !empty($data["menu_activity_is_show"])) {
        $val = [];
        $val["key"] = 6;
        $val["is_show"] = $data["menu_activity_is_show"];
        $val["iconPath"] = "icon-huodong1";
        $val["selectedIconPath"] = "icon-huodong";
        $val["pageComponents"] = "avtivityHome";
        if(isset($data["menu_activity_name"])) {
            $val["name"] = $data["menu_activity_name"];
        }
        if(isset($data["menu_activity_url"])) {
            $val["url"] = $data["menu_activity_url"];
        }
        if(isset($data["menu_activity_url_out"])) {
            $val["url_out"] = $data["menu_activity_url_out"];
        }
        if(isset($data["menu_activity_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_activity_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    if(isset($data["menu_house_is_show"]) && !empty($data["menu_house_is_show"])) {
        $val = [];
        $val["key"] = 5;
        $val["is_show"] = $data["menu_house_is_show"];
        $val["iconPath"] = "icon-fangchan1";
        $val["selectedIconPath"] = "icon-fangchan";
        $val["pageComponents"] = "houseHome";
        if(isset($data["menu_house_name"])) {
            $val["name"] = $data["menu_house_name"];
        }
        if(isset($data["menu_house_url"])) {
            $val["url"] = $data["menu_house_url"];
        }
        if(isset($data["menu_house_url_out"])) {
            $val["url_out"] = $data["menu_house_url_out"];
        }
        if(isset($data["menu_house_url_jump_way"])) {
            $val["url_jump_way"] = $data["menu_house_url_jump_way"];
        }
        $data["data"][] = $val;
    }
    $menus = ["menu1_name", "menu1_is_hide", "menu1_url", "menu1_url_out", "menu1_url_jump_way", "menu2_name", "menu2_is_hide", "menu2_url", "menu2_url_out", "menu2_url_jump_way", "menu3_name", "menu3_is_hide", "menu3_url", "menu3_url_out", "menu3_url_jump_way", "menu4_name", "menu4_is_hide", "menu4_url", "menu4_url_out", "menu4_url_jump_way", "menu_appoint_name", "menu_appoint_is_hide", "menu_appoint_url", "menu_appoint_url_out", "menu_appoint_url_jump_way", "menu_activity_is_show", "menu_activity_name", "menu_activity_is_hide", "menu_activity_url", "menu_activity_url_out", "menu_activity_url_jump_way", "menu_house_is_show", "menu_house_name", "menu_house_is_hide", "menu_house_url", "menu_house_url_out", "menu_house_url_jump_way"];
    foreach ($menus as $menu) {
        unset($data[$menu]);
    }
    return $data;
}
function longbingGetAppTabbarRequest($data)
{
    $result = [];
    foreach ($data as $key => $val) {
        switch ($val["menu_name"]) {
            case "card":
                if(isset($val["is_show"])) {
                    $result["menu1_is_hide"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu1_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu1_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu1_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "shop":
                if(isset($val["is_show"])) {
                    $result["menu2_is_hide"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu2_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu2_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu2_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "dynamic":
                if(isset($val["is_show"])) {
                    $result["menu3_is_hide"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu3_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu3_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu3_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "website":
                if(isset($val["is_show"])) {
                    $result["menu4_is_hide"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu4_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu4_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu4_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "appointment":
                if(isset($val["is_show"])) {
                    $result["menu_appoint_is_hide"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu_appoint_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu_appoint_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu_appoint_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "activity":
                if(isset($val["is_show"])) {
                    $result["menu_activity_is_show"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu_activity_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu_activity_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu_activity_url_jump_way"] = $val["url_jump_way"];
                }
                break;
            case "house":
                if(isset($val["is_show"])) {
                    $result["menu_house_is_show"] = $val["is_show"];
                }
                if(isset($val["name"])) {
                    $result["menu_house_name"] = $val["name"];
                }
                if(isset($val["url_out"])) {
                    $result["menu_house_url_out"] = $val["url_out"];
                }
                if(isset($val["url_jump_way"])) {
                    $result["menu_house_url_jump_way"] = $val["url_jump_way"];
                }
                break;
        }
    }
    return $result;
}

?>